<!DOCTYPE html>
<html>
<head>
<script>

var expectedWidth, expectedHeight;

function onResize() {
  if (window.innerWidth == expectedWidth && window.innerHeight == expectedHeight) {
    domAutomationController.send("resize");
    removeResizeListener();
  }
}

function addResizeListener(width, height) {
  expectedWidth = width;
  expectedHeight = height;
  window.addEventListener('resize', onResize);
}

function removeResizeListener() {
  window.removeEventListener('resize', onResize);
}

function activateFullscreen() {
  document.getElementById("fullscreen-div").webkitRequestFullscreen();
}

function exitFullscreen() {
  document.webkitExitFullscreen();
}

</script>
</head>
<body>

<div>This page contains a div that will go fullscreen</div>

<div id="fullscreen-div" style="border: 1px solid black;">
  This div will go fullscreen
</div>

<iframe id="child-0" srcdoc="This should not go fullscreen"></iframe>

</body>
</html>

